﻿<%@ Page UICulture="vi" Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/MainAdmin.Master"
    CodeBehind="AdminUpdateBook.aspx.vb" Inherits="QLThuVien.AdminUpdateBook" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
    function onUpdateClick(s,e) {

        upload_hinh.UploadFile();
        ASPxGridView1.UpdateEdit();
    }
    function setSession(s,e){
        var path = s.GetText();
        var filename = path.substring(path.lastIndexOf('\\') +1);
        hdf_hinh.value = filename;
    }
    function showAlertMessage(s, e) {
        if (s.cp_showAlertMessage) {
            alert(s.cp_showAlertMessage);
            delete s.cp_showAlertMessage;
        }
    }
</script>   
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="row">
        <div class="col-md-12">
            <h1 class="page-header">
                Cập Nhập Sách
            </h1>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <dx:ASPxGridView ID="ASPxGridView1" runat="server" EnableCallBacks="true" 
                Width="100%" AutoGenerateColumns="False" KeyFieldName="id_sach" ClientIDMode="Static"  >
                <Columns>
                    <dx:GridViewCommandColumn ShowDeleteButton="True" ShowEditButton="True" VisibleIndex="0" Width="100px" CellStyle-HorizontalAlign="Center">
                        <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                    </dx:GridViewCommandColumn>
                    <dx:GridViewDataColumn FieldName="id_sach" VisibleIndex="1" Caption="Mã Sách" ReadOnly="true" CellStyle-HorizontalAlign="Center">
                        <EditFormSettings Visible="False"  />
                         <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                    </dx:GridViewDataColumn>
                    <dx:GridViewDataColumn FieldName="tensach" VisibleIndex="2" Caption="Tên Sách" CellStyle-HorizontalAlign="Center">
                        <EditFormSettings VisibleIndex="0" />
                         <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                    </dx:GridViewDataColumn>
                    <dx:GridViewDataColumn FieldName="nxb" VisibleIndex="3" Caption="Nhà Xuất Bản" CellStyle-HorizontalAlign="Center">
                        <EditFormSettings VisibleIndex="1" />
                        <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                    </dx:GridViewDataColumn>
                    <dx:GridViewDataColumn FieldName="tacgia" VisibleIndex="4" Caption="Tác Giả" CellStyle-HorizontalAlign="Center">
                        <EditFormSettings VisibleIndex="2" />
                         <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                    </dx:GridViewDataColumn>
         
                    <dx:GridViewDataColumn FieldName="tendm" VisibleIndex="5" Caption="Danh Mục" ReadOnly="true" CellStyle-HorizontalAlign="Center">
              <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                    <EditFormSettings Visible="False" />  
                    </dx:GridViewDataColumn>
                    <dx:GridViewDataColumn FieldName="phanloai" VisibleIndex="6" Caption="Phân Loại" CellStyle-HorizontalAlign="Center">
                        <EditItemTemplate>
                            <dx:ASPxComboBox ID="cbb_phanloai" runat="server" ValueType="System.String" TextField="phanloai" ValueField="phanloai" OnInit="cb_phanloai" >
                            </dx:ASPxComboBox>
                        </EditItemTemplate>
                         <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                    </dx:GridViewDataColumn>
                    <dx:GridViewDataDateColumn FieldName="ngaynhap" VisibleIndex="7" Caption="Ngày Nhập" CellStyle-HorizontalAlign="Center"
                        Width="10%">
                        <EditFormSettings VisibleIndex="4" />
                         <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                          <PropertiesDateEdit DisplayFormatString="dd/MM/yyyy" DisplayFormatInEditMode="True"></PropertiesDateEdit>
                    </dx:GridViewDataDateColumn>
                    <dx:GridViewDataImageColumn FieldName="hinh" VisibleIndex="9" Caption="Hình Ảnh"
                        EditFormSettings-Visible="True">
                         <HeaderStyle Font-Bold="True" BackColor="#428bca" ForeColor="White"  HorizontalAlign="Center"  />
                        <PropertiesImage ImageHeight="100px" ImageWidth="100px">
                        </PropertiesImage>

                        <EditFormSettings Visible="True"></EditFormSettings>
                        <EditItemTemplate>
                        
                            <dx:ASPxUploadControl ID="upload_hinh" runat="server" UploadMode="Auto"  ClientInstanceName="upload_hinh" 
                                Width="100%" BrowseButton-Text="Chọn Hình..." 
                                onfileuploadcomplete="upload_hinh_FileUploadComplete" >
                            <ClientSideEvents TextChanged="setSession" />  
                            </dx:ASPxUploadControl>
                         
                        </EditItemTemplate>
                    </dx:GridViewDataImageColumn>
                </Columns>
                <Settings ShowFilterRow="True" ShowGroupPanel="True" ShowStatusBar="Hidden" ShowFilterRowMenu="true" ShowGroupButtons="true" ShowFilterRowMenuLikeItem="true" ShowFilterBar="Visible"     />
                <SettingsEditing EditFormColumnCount="3" />
                <SettingsDataSecurity AllowInsert="False" />
                <SettingsSearchPanel Visible="True" />
                <SettingsPager Position="TopAndBottom" PageSizeItemSettings-Items="5,10,15,20" PageSizeItemSettings-Visible="true">
                    <PageSizeItemSettings Items="5, 10, 15, 20" Visible="True">
                    </PageSizeItemSettings>
                </SettingsPager>
                 <SettingsBehavior ConfirmDelete="true"/>
                  <SettingsText ConfirmDelete="Bạn có muốn xóa không?"  />
                <SettingsPopup>
                    <EditForm Width="80%" Modal="true" />
                </SettingsPopup>
                 <SettingsCommandButton>
            <EditButton Image-IconID="actions_edit_16x16devav" ButtonType="Image">
<Image IconID="actions_edit_16x16devav"></Image>
                     </EditButton>
            <DeleteButton Image-IconID="actions_cancel_16x16office2013" ButtonType="Image">
<Image IconID="actions_cancel_16x16office2013"></Image>
                     </DeleteButton>
            <UpdateButton Image-IconID="actions_refresh_16x16office2013" ButtonType="Image">
<Image IconID="actions_refresh_16x16office2013"></Image>

                     </UpdateButton>
            <CancelButton Image-IconID ="actions_close_16x16devav" ButtonType="Image" >
<Image IconID="actions_close_16x16devav"></Image>
                     </CancelButton>
        </SettingsCommandButton>    
                <Templates>
                    <EditForm>
                        <div style="padding: 4px 4px 3px 4px">
                            <dx:ASPxPageControl runat="server" ID="pageControl" Width="100%">
                                <TabPages>
                                    <dx:TabPage Text="Thông Tin" Visible="true">
                                        <ContentCollection>
                                            <dx:ContentControl ID="ContentControl1" runat="server">
                                                <dx:ASPxGridViewTemplateReplacement ID="Editors" ReplacementType="EditFormEditors"
                                                    runat="server"></dx:ASPxGridViewTemplateReplacement>
                                            </dx:ContentControl>
                                        </ContentCollection>
                                    </dx:TabPage>
                                    <dx:TabPage Text="Chi Tiết" Visible="true">
                                        <ContentCollection>
                                            <dx:ContentControl runat="server" >
                                                <dx:ASPxMemo ID="ASPxMemo_ChiTiet" runat="server" Height="71px" Width="100%" Text='<%#Eval("chitiet")%>'>
                                                </dx:ASPxMemo>
                             
                                            </dx:ContentControl>
                                        </ContentCollection>
                                    </dx:TabPage>
                                </TabPages>
                            </dx:ASPxPageControl>
                        </div>
                        <div style="text-align: right; padding: 2px 2px 2px 2px">    
                            <dx:ASPxButton ID="btn_update" runat="server" Image-IconID="actions_refresh_16x16office2013" Border-BorderStyle="None" HoverStyle-BackColor="White" Paddings-PaddingTop="5px"  AutoPostBack="false"  >
                            <ClientSideEvents Click="onUpdateClick"  />
                            </dx:ASPxButton>
                            <dx:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton"
                                runat="server"></dx:ASPxGridViewTemplateReplacement>
                        </div>
                    </EditForm>
                </Templates>
                <ClientSideEvents EndCallback="showAlertMessage" />
            </dx:ASPxGridView>
        </div>
    </div>
    <asp:HiddenField ID="hdf_hinh" runat="server" ClientIDMode="Static"/>
</asp:Content>
